package com.cow.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cow.mapper.AdminMapper;
import com.cow.pojo.Admin;
import com.cow.pojo.AdminExample;
import com.cow.service.AdminService;

/**
 * @author 光环and鬼泣
 * @version 2018年5月30日 上午9:59:26
 */
@Service("adminService")
public class AdminServiceImpl implements AdminService {

	@Autowired
	private AdminMapper adminMapper = null;

	@Override
	public boolean login(String username, String password) throws Exception {
		AdminExample example = new AdminExample();
		AdminExample.Criteria criteria = example.createCriteria();
		criteria.andUsernameEqualTo(username);
		criteria.andPasswordEqualTo(password);
		List<Admin> admin = adminMapper.selectByExample(example);
		if (admin.size() > 0) {
			return true;
		} else {
			return false;
		}

	}

}
